package com.gl.codewar.template;

public class DiamondsAreForever {

	public static String drawDiamond(String string, int n) {
		
		
		String l = "";
		int anterior = 0;
		for(int i = 0 ; i < n -1 ; i++){
			int j;
			for(j = 0 ; j < n-i-1 ; j++){
				l += " ";
			}
			
			if(i!=0 && i!=n-1){
				l += string;
				int k = n - j - 1 +anterior;
				for(int y = 0 ; y < k ; y++){
					l += " ";
				}
				l += string+"\n";
				anterior = i;
			}else{
				l += string+"\n";
			}
			
		}
		System.out.println(l);
		
		String[] lines = l.split("\n");
		
		l += string;
		
		for(int g = 0 ; g < n + (n - 3) ; g++){
			l += " ";
		}
		l += string;
		
		
		for(int i = lines.length-1 ; i > -1 ; i--){
			l += "\n"+lines[i];
		}
		
		return l+"\n";
	}

	public static String reverse(String n){
		String n2 = "";
		for(int i = n.length()-1 ; i > -1 ; i--){
			n2 += n.substring(i,i+1);
		}
		return n2;
	}
	
}
